/*
 * ExtFieldValuePK.java
 *
 * $Id: ExtFieldValuePK.java,v 1.1 2008-03-18 12:58:45 mario Exp $
 *
 * Written by: Mario García García <mario@imagos.es>
 * (c) 2007 Fundación Centro Tecnológico de la Carne
 * 
 */
package org.ceteca.explica.core.extTables;

import java.io.Serializable;

/**
 * Store class to hold the primary key of any extension field value 
 * (of any type). 
 * <br/>
 * Responsibilities:
 * <li>
 * 	<ul> Store of primary key of an extension field value for implementing
 * the Hibernate mapping. </ul>
 * </li>
 */
public class ExtFieldValuePK implements Serializable {
	/**
	 * Internal Id of the extension field.
	 */
	private long idExtField;
	/**
	 * Value of the id field in the original table (extended table id). It's the 
	 * id value of the extended item.
	 */
	private long idValue;
	
	private static final long serialVersionUID = 10000006;
	
	public ExtFieldValuePK(long idExtField, long idValue) {
		this.setIdExtField(idExtField);
		this.setIdValue(idValue);
	}

	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + (int) (idExtField ^ (idExtField >>> 32));
		result = PRIME * result + (int) (idValue ^ (idValue >>> 32));
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final ExtFieldValuePK other = (ExtFieldValuePK) obj;
		if (idExtField != other.idExtField)
			return false;
		if (idValue != other.idValue)
			return false;
		return true;
	}

	public long getIdExtField() {
		return idExtField;
	}

	public void setIdExtField(long idExtField) {
		this.idExtField = idExtField;
	}

	public long getIdValue() {
		return idValue;
	}

	public void setIdValue(long idValue) {
		this.idValue = idValue;
	}

	/**
	 * Returns tag Id assigned to CVS source file.
	 */
	public static String getRevision() {
		return "$Id: ExtFieldValuePK.java,v 1.1 2008-03-18 12:58:45 mario Exp $";
	}
}
